package com.whfc.ms.api.fvs.service.impl;

import com.whfc.common.result.ListData;
import com.whfc.common.result.PageData;
import com.whfc.fvs.dto.*;
import com.whfc.fvs.enums.FvsDevicePtzOption;
import com.whfc.fvs.enums.FvsDeviceStatus;
import com.whfc.fvs.param.FvsDeviceAddParam;
import com.whfc.fvs.param.FvsDeviceEditParam;
import com.whfc.fvs.param.FvsDeviceListParam;
import com.whfc.fvs.service.FvsDeviceService;
import com.whfc.fvs.service.FvsSnapshotService;
import com.whfc.ms.api.fvs.service.MsFvsDeviceService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.Method;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author : qzexing
 * @version : 1.0
 * @date : 2020-09-24 16:45
 */
@Service
public class MsFvsDeviceServiceImpl implements MsFvsDeviceService {

    @DubboReference(interfaceClass = FvsDeviceService.class, version = "1.0.0",
            methods = {@Method(name = "ptz", async = true, isReturn = false)})
    private FvsDeviceService fvsDeviceService;

    @DubboReference(interfaceClass = FvsSnapshotService.class, version = "1.0.0")
    private FvsSnapshotService fvsSnapshotService;

    @Override
    public PageData<FvsDeviceDTO> deviceList(FvsDeviceListParam fvsDeviceListParam) {
        return fvsDeviceService.deviceList(fvsDeviceListParam);
    }

    @Override
    public PageData<FvsDeviceDTO> list(FvsDeviceListParam fvsDeviceListParam) {
        return fvsDeviceService.list(fvsDeviceListParam);
    }

    @Override
    public ListData<FvsDeviceDTO> listData(FvsDeviceListParam fvsDeviceListParam) {
        return fvsDeviceService.listData(fvsDeviceListParam);
    }

    @Override
    public List<FvsDeviceDTO> list(Integer platform) {
        return fvsDeviceService.list(platform);
    }

    @Override
    public FvsDeviceDTO detail(Integer id) {
        return fvsDeviceService.detail(id);
    }

    @Override
    public void deviceAdd(FvsDeviceAddParam deviceAddParam) {
        fvsDeviceService.deviceAdd(deviceAddParam);
    }

    @Override
    public void deviceEdit(FvsDeviceEditParam deviceEditParam) {
        fvsDeviceService.deviceEdit(deviceEditParam);
    }

    @Override
    public void delDevice(Integer deviceId) {
        fvsDeviceService.delDevice(deviceId);
    }

    @Override
    public FvsStreamDTO getStreamUrl(Integer deviceId) {
        return fvsDeviceService.getStreamUrl(deviceId);
    }

    @Override
    public ListData<FvsRecordDTO> getRecordList(Integer deviceId, Date startTime, Date endTime) {
        return fvsDeviceService.getRecordList(deviceId, startTime, endTime);
    }

    @Override
    public List<FvsStreamDTO> listStreams(Integer deptId, Integer bizType, Integer platform) {
        return fvsDeviceService.listStreams(deptId, bizType, platform);
    }

    @Override
    public void batchUpdateDeviceStatus(List<Integer> deviceIdList, FvsDeviceStatus fvsDeviceStatus) {
        fvsDeviceService.batchUpdateDeviceStatus(deviceIdList, fvsDeviceStatus);
    }

    @Override
    public FvsDeviceDTO selectByGbId(String gbId) {
        return fvsDeviceService.selectByGbId(gbId);
    }

    @Override
    public FvsDeviceDTO selectByAliDeviceId(String aliDeviceId) {
        return fvsDeviceService.selectByAliDeviceId(aliDeviceId);
    }

    @Override
    public FvsDeviceDTO selectByAliStreamId(String aliStreamId) {
        return fvsDeviceService.selectByAliStreamId(aliStreamId);
    }

    @Override
    public void updateSnapshotUrlByGbId(String gbId, String snapshotUrl) {
        fvsDeviceService.updateSnapshotUrlByGbId(gbId, snapshotUrl);
    }

    @Override
    public void updateByAliDeviceId(String aliDeviceId, Integer deviceStatus, Integer streamStatus) {
        fvsDeviceService.updateByAliDeviceId(aliDeviceId, deviceStatus, streamStatus);
    }

    @Override
    public void updateByAliStreamId(String aliStreamId, Integer deviceStatus, Integer streamStatus, String snapshotUrl) {
        fvsDeviceService.updateByAliStreamId(aliStreamId, deviceStatus, streamStatus, snapshotUrl);
    }

    @Override
    public void ptz(Integer deviceId, FvsDevicePtzOption devicePtzOption) {
        fvsDeviceService.ptz(deviceId, devicePtzOption);
    }

    @Override
    public FvsTokenDTO getToken(Integer deptId, Integer platform) {
        return fvsDeviceService.getToken(deptId, platform);
    }

    @Override
    public List<FvsVideoDTO> getVideoList(Integer deptId) {
        return fvsDeviceService.getVideoList(deptId);
    }

    @Override
    public FvsLogDTO log(Integer deptId, Date date) {
        return fvsSnapshotService.fvsLog(deptId, date);
    }
}
